package intersection;

import java.util.ArrayList;
import java.util.List;

public class Solution {
    public List<Integer> intersection(int[][] nums) {
        List<Integer> ans = new ArrayList<>();
        int[] marks = new int[1001];
        for (int i = 0; i < nums.length; i++) {
            for (int j = 0; j < nums[i].length; j++) {
                marks[nums[i][j]]++;
            }
        }
        for (int i = 0; i < marks.length; i++) {
            if(marks[i] == nums.length) {
                ans.add(i);
            }
        }
        return ans;
    }
}
